<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>js工具</title>
    <script src="./js/vue/vue.min.js"></script>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>

</head>
<body>
    <div id="app">
        <b>时间范围-年：{{yearArr}}</b>  
        <hr/> 
        <b>时间范围-周：{{weekArr}}</b>
        <hr/> 
        <b>姓名：{{maskUtils.realNameMask('达文西')}}</b>
        <b>电话：{{maskUtils.phoneMask('1311113980')}}</b>
        <hr>
        <input type="text" v-model="searchKey"><button @click="searchData">搜索</button>
        <ul v-for="item in backData">
            <li>{{item.doctorName}}</li>
        </ul>
    </div>
</body>
    <script type="module">
    import { getDateArray,getWeek,maskUtils,WeekDays,search } from './js/main.js';
    new Vue({
        el: '#app',
        data() {
            return {
                maskUtils,
                WeekDays,
                yearArr:[],
                weekArr:[],
                holidays:[],//2020
                searchKey:'',
                seacrhArr:[
                    {
                        deptId: 1,
                        deptName: "内科",
                        description: "介绍1",
                        doctorId: 1,
                        doctorLevel: "主治医师",
                        doctorLevelCode: "01",
                        doctorName: "张三",
                    },
                    {
                        deptId: 1,
                        deptName: "内科",
                        description: "介绍2",
                        doctorId: 2,
                        doctorLevel: "医师",
                        doctorLevelCode: "02",
                        doctorName: "李四",
                    },
                    {
                        deptId: 2,
                        deptName: "外科",
                        description: "介绍3",
                        doctorId: 3,
                        doctorLevel: "医师",
                        doctorLevelCode: "02",
                        doctorName: "王五",
                    },
                    {
                        deptId: 2,
                        deptName: "眼科",
                        description: "介绍4",
                        doctorId: 4,
                        doctorLevel: "主治医师",
                        doctorLevelCode: "01",
                        doctorName: "王三",
                    },
                ],
                backData:[]
            };
        },
        methods:{
            getHolidays(){
                axios.get('api/8aQDcjqpAAV3otqbppnN2DJv/api.php?query=2020&resource_id=6018').then(res =>{
                    console.log(res.data.data[0]);
                    this.holidays = res.data.holiday
                })
            },
            searchData(){
               this.backData = search(this.searchKey,this.seacrhArr,'doctorName')
            }
        },
        created() {
            this.yearArr = getDateArray(2018,2022)//开始时间，结束时间
            let date = new Date('1999-03-28',)
            this.weekArr = getWeek(date)//起始时间
            // this.getHolidays()
            let days = WeekDays.isWeekend('2022-01-02','2022-01-05',7)//开始时间，介绍时间，时间范围
            let days2 = WeekDays.isholiday('2022-01-02','2022-01-05',7)//开始时间，介绍时间，时间范围
            console.log(days);
            console.log(days2);
            console.log(this.seacrhArr);
        },
    })
    </script>
</html>